<template>
  <div>
    <el-dropdown @command="selectLang">
      <span style="color:#fff;">{{ $i18n.locale==='zh'?'Language':'选择语言' }}</span>
      <el-dropdown-menu>
        <el-dropdown-item command="zh" :disabled="$i18n.locale==='zh'">中文</el-dropdown-item>
        <el-dropdown-item command="en" :disabled="$i18n.locale==='en'">English</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  methods: {
    selectLang(val) {
      console.log(val)
      localStorage.setItem('language', val)
      this.$i18n.locale = val
    }
  }
}
</script>

<style>

</style>
